package com.sright.bcard.mini.web.controller;

import com.sright.bcard.common.service.share.dto.request.CuFaceCacheRequest;
import com.sright.bcard.content.share.service.CardService;
import com.sright.bcard.mini.web.constant.WebUrl;
import com.sright.common.response.SrightResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 企业和个人名片controller
 */
@RestController
public class CardInfoController {

    @Autowired
    private CardService cardService;

    /**
     * 获取名片个人信息
     * @param userId 用户ID（新）
     * @param oldPersonalUserId 老个人用户ID
     * @param oldEnterpriseUserId 老企业用户ID
     * @return
     */
    @GetMapping(WebUrl.cardInfoDetail)
    public SrightResponse enterpriseCardInfoDetail(Long userId, Long oldPersonalUserId, Long oldEnterpriseUserId) {
        return cardService.cardInfoDetail(userId,oldPersonalUserId,oldEnterpriseUserId);
    }

    @GetMapping(WebUrl.cardConnectInfo)
    public SrightResponse cardConnectInfo(Long userId, Long oldPersonalUserId, Long oldEnterpriseUserId) {
        return cardService.cardConnectInfo(userId,oldPersonalUserId,oldEnterpriseUserId);
    }

    /**
     * 获取名片素材信息(老)
     * @param cardId 名片ID
     * @return
     */
    @GetMapping(WebUrl.cardMaterialDetail)
    public SrightResponse enterpriseCardMaterialDetail(Long cardId) {
        return cardService.cardMaterialDetail(cardId);
    }

    /**
     * 获取名片素材信息(新)
     * @param cardId 名片ID
     * @return
     */
    @GetMapping(WebUrl.cardMaterialDetailNew)
    public SrightResponse enterpriseCardMaterialDetailNew(Long cardId) {
        return cardService.cardMaterialDetailNew(cardId);
    }

    /**
     * 获取名片信息和素材信息
     * @return
     */
    @GetMapping(WebUrl.cardInfoMaterialDetail)
    public SrightResponse cardInfoMaterialDetail(CuFaceCacheRequest cuFaceCacheRequest) {
        return cardService.cardInfoMaterialDetail(cuFaceCacheRequest);
    }

    /**
     * 删除用户名片公司信息
     * @param cardUserCompanyInfoId
     * @param userId
     * @return
     */
    @GetMapping(WebUrl.DeleteUserCompanyInfo)
    public SrightResponse deleteUserCompanyInfo(Long cardUserCompanyInfoId,Long userId) {
        return cardService.deleteUserCompanyInfo(cardUserCompanyInfoId,userId);
    }

}
